#ifndef __NRF_PROCESS_H_
#define __NRF_PROCESS_H_

#include "app.h"
#include "user_cfg.h"
#include "timeout.h"

#define PAIR_TIMEOUT (10000) /* 配对超时*/
#define REV_LEN      (7)     /* 接收数据长度*/

#define PRESS_LONG_PAIR         (1500) /* 长按配对时间*/
#define UI_BACK_TIMEOUT         (2000)
typedef struct {
    uint8_t pair_flag; /* 配对标志*/
    uint8_t pair_ui_back;
    uint8_t long_press_pair; /* 长按配对*/
    uint32_t long_press_time; /* 长按时间*/
    struct {
        timeout_para_t pair_tout; /* 配对超时*/
        timeout_para_t send_tout; /* 发送间隔*/
        timeout_para_t release_tout;
        timeout_para_t pair_ui_back_tout;
    } tout;
    struct {
        uint8_t  rev_buf[REV_LEN]; /* 接收缓存数据*/
        uint8_t  rev_len;          /* 接收缓存数据长度*/
        uint8_t  rev_pipe;         /* 接收数据通道*/
        uint32_t rev_cmd;          /* 接收数据*/
        uint8_t start_send_flag;
        uint8_t stop_send_flag;
        uint32_t send_cmd;
    } nrf;
} nrf_para_t;

extern nrf_para_t nrf_para;

uint8_t Get_Nrf_Pair_State(void);

void Nrf_Send_Msg_Handle(uint32_t val);

void Nrf_Enter_Pair(void);

void Nrf_Exit_Pair(void);

void Nrf_Rev_Handle(void);

void Nrf_Process_Init(void);

void Nrf_Process(void);

void Pair_Long_Handle(void);

#endif /*__NRF_PROCESS_H_*/
